<!DOCTYPE html>
<html dir="<?php echo $direction; ?>" lang="<?php echo $lang; ?>">
<head>
<meta charset="UTF-8" />
<title><?php echo $title; ?></title>
<base href="<?php echo $base; ?>" />
<?php if ($description) { ?>
<meta name="description" content="<?php echo $description; ?>" />
<?php } ?>
<?php if ($keywords) { ?>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<?php } ?>
<?php if ($icon) { ?>
<link href="<?php echo $icon; ?>" rel="icon" />
<?php } ?>
<?php foreach ($links as $link) { ?>
<link href="<?php echo $link['href']; ?>" rel="<?php echo $link['rel']; ?>" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/stylesheet.css" />
<?php foreach ($styles as $style) { ?>
<link rel="<?php echo $style['rel']; ?>" type="text/css" href="<?php echo $style['href']; ?>" media="<?php echo $style['media']; ?>" />
<?php } ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/ui/jquery-ui-1.8.16.custom.min.js"></script>
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/ui/themes/ui-lightness/jquery-ui-1.8.16.custom.css" />
<script type="text/javascript" src="catalog/view/javascript/jquery/ui/external/jquery.cookie.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/colorbox/jquery.colorbox.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/jquery.jscrollpane.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/jquery.mousewheel.js"></script>
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/colorbox/colorbox.css" media="screen" />
<script type="text/javascript" src="catalog/view/javascript/jquery/tabs.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/easySlider1.7.js"></script>
<script type="text/javascript" src="catalog/view/javascript/common.js"></script>
<?php foreach ($scripts as $script) { ?>
<script type="text/javascript" src="<?php echo $script; ?>"></script>

<?php } ?>
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/ie7.css" />
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/ie6.css" />
<script type="text/javascript" src="catalog/view/javascript/DD_belatedPNG_0.0.8a-min.js"></script>
<script type="text/javascript">
DD_belatedPNG.fix('#logo img');
</script>
<![endif]-->
<?php echo $google_analytics; ?>
</head>
<body class="color_<?php echo $path?>">
<div id="container">
<div id="header">
	<div class="main">
	  <?php if ($logo) { ?>
	  <div id="logo"><a href="<?php echo $home; ?>"><img src="<?php echo $logo; ?>" title="<?php echo $name; ?>" alt="<?php echo $name; ?>" /></a></div>
	  <?php } ?>
	  <div class="flash"><img src="<?php echo $base?>image/data/banner1.jpg" /></div>	    	 
	</div>   	
</div>
<?php if ($categories) { ?>
<div id="menu">
	<div class="main clearfix">
	  <ul class="mainnav">
	    <?php foreach ($categories as $category) { ?>
	    <li class="li_level_1">
	      <a id="<?php echo $category['color'] ?>" style="<?php if($category['category_id'] == $path) echo 'background-color:'.$category['color']; ?>" class="a_level_1 <?php if($category['category_id'] == $path) echo 'current'?>" href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
	      <?php if ($category['children']) { ?>
	      <div class="level_2">
	        <?php for ($i = 0; $i < count($category['children']);) { ?>
	        <ul>
	          <?php $j = $i + ceil(count($category['children']) / $category['column']); ?>
	          <?php for (; $i < $j; $i++) { ?>
	          <?php if (isset($category['children'][$i])) { ?>
	          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
	          <?php } ?>
	          <?php } ?>
	        </ul>
	        <?php } ?>
	      </div>
	      <?php } ?>
	    </li>
	    <?php } ?>
	  </ul>
	  <div class="right">
		<div id="search">
			<?php if ($filter_name) { ?>
		    <input class="input_search" type="text" name="filter_name" value="<?php echo $filter_name; ?>" />
		    <?php } else { ?>
		    <input class="input_search" type="text" name="filter_name" value="<?php echo $text_search; ?>" onclick="this.value = '';" onkeydown="this.style.color = '#000000';" />
		    <?php } ?>						
			<input type="image" src="../catalog/view/theme/default/image/buttom_search_menu.jpg" id="button-search" class="button-search"  alt=""  value="Tìm kiếm..."/>
		</div>
	  </div>	 
    </div>
</div>
<?php } ?>
<div id="notification"></div>
<script type="text/javascript">
    $(document).ready(function(){
    $(".a_level_1").hover(function(){
        $(this).css("background-color",$(this).attr('id'));
    },function(){
        if(!$(this).hasClass('current'))
            $(this).css("background-color","");
  });
$('#container input[name=\'filter_name\']').keydown(function(e) {
	if (e.keyCode == 13) {
		$('#button-search').trigger('click');
	}
});

$('#button-search').bind('click', function() {
	url = 'index.php?route=product/search';
	
	var filter_name = $('#container input[name=\'filter_name\']').attr('value');
	
	if (filter_name) {
		url += '&filter_name=' + encodeURIComponent(filter_name);
	}

	var filter_category_id = $('#container select[name=\'filter_category_id\']').attr('value');
	
	if (filter_category_id > 0) {
		url += '&filter_category_id=' + encodeURIComponent(filter_category_id);
	}
	
	var filter_sub_category = $('#container input[name=\'filter_sub_category\']:checked').attr('value');
	
	if (filter_sub_category) {
		url += '&filter_sub_category=true';
	}
		
	var filter_description = $('#container input[name=\'filter_description\']:checked').attr('value');
	
	if (filter_description) {
		url += '&filter_description=true';
	}

	location = url;
});
});
</script>
